package com.zhangc.blog.base.utils;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSONObject;
import com.zhangc.blog.base.ResultBO;

/**
 * 功能描述:<br>
 *
 * @author wx:fdzhangc
 * @see [相关类/方法]（可选）
 * @since [产品/模块版本] （可选）
 */
public class ResponseUtils {
    public static void out(HttpServletResponse httpServletResponse, String code, String msg) throws IOException {
        httpServletResponse.setContentType("application/json;charset=UTF-8");
        PrintWriter out = httpServletResponse.getWriter();
        String errorJson = JSONObject.toJSONString(ResultBO.error(null, code, msg));
        out.write(errorJson);
        out.flush();
        out.close();
    }

}
